home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CBASE102.ARJ / ANSI.H < prev    next >
Text File  |  1991-08-22  |  6KB  |  209 lines

  1. /*    Copyright (c) 1991 Citadel    */
  2. /*       All Rights Reserved        */
  3.  
  4. /*man---------------------------------------------------------------------------
  5. NAME
  6.      ansi.h - ansi compatibility header
  7.  
  8. SYNOPSIS
  9.      #include <ansi.h>
  10.  
  11. DESCRIPTION
  12.      <ansi.h> isolates the definitions and declarations used in making
  13.      source code portable between ANSI C and older versions.  The main
  14.      component of this header is a collection of ANSI compatibility
  15.      macros of the form AC_*.  The definition of each of these macros
  16.      indicates support for a specific feature.  AC_PROTO, for
  17.      instance, is defined if function prototypes are supported.  These
  18.      macros are used in #ifdef constructs such as the following:
  19.  
  20.           #ifdef AC_PROTO
  21.           int f(int n)
  22.           #else
  23.           int f(n)
  24.           int n;
  25.           #endif
  26.  
  27.      The new ANSI C keywords (const, signed, void, and volatile) can
  28.      be handled with less effort; if the keyword is not supported,
  29.      that keyword is simply defined in <ansi.h>, effectively removing
  30.      it from the source code.
  31.  
  32. NOTES
  33.      To install <ansi.h>, first set the AC_* and keyword macros to be
  34.      consistent with the compiler being used.  Next examine the lines
  35.      marked "NON-PORTABLE" to see if any changes are necessary in
  36.      those places.  If a completely ANSI compatible compiler is being
  37.      used, no changes to <ansi.h> should be required.  Once the header
  38.      has been set up correctly, copy it to the include directory
  39.      (e.g., /usr/include for UNIX).
  40.  
  41. ------------------------------------------------------------------------------*/
  42. #ifndef H_ANSI        /* prevent multiple includes */
  43. #define H_ANSI
  44.  
  45. /* #ident    "@(#)ansi.h    1.1 - 91/08/21" */
  46.  
  47. /* ANSI C compatibility macros */
  48. #define AC_STRCAT        /* enable string catenation */
  49. #define AC_TOKPST        /* enable token pasting */
  50. #define AC_LDOUBLE        /* enable long double data type */
  51. #define AC_PRINTF        /* enable new printf features (%*) */
  52. #define AC_PROTO        /* enable function prototypes */
  53. #define AC_STDARG        /* enable <stdarg.h> */
  54. #define AC_STDDEF        /* enable <stddef.h> */
  55. #define AC_ESCAPE        /* enable new ansi escape sequences (\a, \v) */
  56. #define AC_STDLIB        /* enable <stdlib.h> */
  57. #define AC_STRING        /* enable <string.h> */
  58. #define AC_VOIDP        /* enable void pointers */
  59. /*#define const            /* disable const keyword */
  60. /*#define signed        /* disable signed keyword */
  61. /*#define void            /* disable void keyword */
  62. /*#define volatile        /* disable volatile keyword */
  63.  
  64. /* stddef patches */
  65. #ifdef AC_STDDEF
  66. #include <stddef.h>
  67. #else
  68. #include <sys/types.h>        /* size_t typedef -- NON-PORTABLE */
  69. #endif
  70. #ifndef offsetof
  71. #define offsetof(struct_t, member)    ((size_t)(char *)&((struct_t *)0)->member)
  72. #endif
  73.  
  74. /* stdio patches */
  75. #include <stdio.h>
  76. #include <limits.h>
  77. #ifndef FOPEN_MAX
  78. #define FOPEN_MAX    OPEN_MAX    /* NON-PORTABLE */
  79. #endif
  80. #ifndef FILENAME_MAX
  81. #define FILENAME_MAX    NAME_MAX    /* NON-PORTABLE */
  82. #endif
  83.  
  84. /* stdlib.h patches */
  85. #ifndef AC_STDLIB
  86. #define EXIT_SUCCESS    (0)
  87. #define EXIT_FAILURE    (1)
  88. typedef struct {
  89.     int quot;
  90.     int rem;
  91. } div_t;
  92. typedef struct {
  93.     long int quot;
  94.     long int rem;
  95. } ldiv_t;
  96. #ifdef AC_PROTO
  97. double    atof(const char *);
  98. int    atoi(const char *);
  99. long int atol(const char *);
  100. double    strtod(const char *, char **);
  101. long int strtol(const char *, char **, int);
  102. unsigned long int strtoul(const char *, char **, int);
  103. int    rand(void);
  104. void    srand(unsigned int);
  105. void *    calloc(size_t, size_t);
  106. void *    malloc(size_t);
  107. void *    realloc(void *, size_t);
  108. void    free(void *);
  109. void    abort(void);
  110. int    atexit(void (*)(void));
  111. void    exit(int);
  112. char *    getenv(const char *);
  113. int    system(const char *);
  114. void *    bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
  115. void    qsort(void *, size_t, size_t, int (*)(const void *, const void *));
  116. int    abs(int);
  117. div_t    div(int, int);
  118. long int labs(long int);
  119. ldiv_t    ldiv(long int, long int);
  120. int    mblen(const char *, size_t);
  121. /*int    mbtowc(wchar_t *, const char *, size_t);
  122. int    wctomb(char *, wchar_t);
  123. size_t    mbstowcs(wchar_t *, const char *, size_t);
  124. size_t    wcstombs(char *, wchar_t const *, size_t);*/
  125. #else
  126. double    atof();
  127. int    atoi();
  128. long int atol();
  129. double    strtod();
  130. long int strtol();
  131. unsigned long int strtoul();
  132. int    rand();
  133. void    srand();
  134. void *    calloc();
  135. void *    malloc();
  136. void *    realloc();
  137. void    free();
  138. void    abort();
  139. int    atexit();
  140. void    exit();
  141. char *    getenv();
  142. int    system();
  143. void *    bsearch();
  144. void    qsort();
  145. int    abs();
  146. div_t    div();
  147. long int labs();
  148. ldiv_t    ldiv();
  149. int    mblen();
  150. int    mbtowc();
  151. int    wctomb();
  152. size_t    mbstowcs();
  153. size_t    wcstombs();
  154. #endif
  155. #endif
  156.  
  157. /* string.h patches */
  158. #ifndef AC_STRING
  159. #ifdef AC_PROTO
  160. void *    memcpy(void *, const void *, size_t);
  161. void *    memmove(void *, const void *, size_t);
  162. char *    strcpy(char *, const char *);
  163. char *    strncpy(char *, const char *, size_t);
  164. char *    strcat(char *, const char *);
  165. char *    strncat(char *, const char *, size_t);
  166. int    memcmp(const void *, const void *, size_t);
  167. int    strcmp(const char *, const char *);
  168. int    strcoll(const char *, const char *);
  169. int    strncmp(const char *, const char *, size_t);
  170. size_t    strxfrm(char *, const char *, size_t);
  171. void *    memchr(const void *, int, size_t);
  172. char *    strchr(const char *, int);
  173. size_t    strcspn(const char *, const char *);
  174. char *    strpbrk(const char *, const char *);
  175. char *    strrchr(const char *, int);
  176. size_t    strspn(const char *, const char *);
  177. char *    strstr(const char *, const char *);
  178. char *    strtok(char *, const char *);
  179. void *    memset(void *, int, size_t);
  180. char *    strerror(int);
  181. size_t    strlen(const char *);
  182. #else
  183. void *    memcpy();
  184. void *    memmove();
  185. char *    strcpy();
  186. char *    strncpy();
  187. char *    strcat();
  188. char *    strncat();
  189. int    memcmp();
  190. int    strcmp();
  191. int    strcoll();
  192. int    strncmp();
  193. size_t    strxfrm();
  194. void *    memchr();
  195. char *    strchr();
  196. size_t    strcspn();
  197. char *    strpbrk();
  198. char *    strrchr();
  199. size_t    strspn();
  200. char *    strstr();
  201. char *    strtok();
  202. void *    memset();
  203. char *    strerror();
  204. size_t    strlen();
  205. #endif
  206. #endif
  207.  
  208. #endif    /* #ifndef H_ANSI */
  209.